package soft863.com.demo1007;

import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class fRd extends Reducer<Text, Flow, Text, Flow> {
    @Override
    protected void reduce(Text key, Iterable<Flow> values, Context context) throws IOException, InterruptedException {
        long upsum = 0;
        long downsum = 0;
        long sum = 0;
        for (Flow i : values
        ) {
            upsum += i.getUpflow();
            downsum += i.getDownflow();
            sum += i.getSumflow();
        }

        context.write(key, new Flow(upsum, downsum, sum));


    }
}
